package com.boolib.animate.framework.service.advice;

import com.alibaba.fastjson.JSON;
import com.boolib.animate.commons.Consts;
import com.boolib.animate.framework.entity.AnimateChapter;
import com.boolib.animate.framework.entity.AnimateChapterComment;
import com.boolib.animate.framework.entity.AnimateChapterContent;
import com.boolib.animate.framework.service.base.impl.BaseAnimateChapterCommentService;
import com.boolib.animate.framework.service.base.impl.BaseAnimateChapterContentService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;

/**
 * @author nier
 * @create 2020-02-29 11:20
 */
@Slf4j
@Service
public class AnimateChapterContentService {

    @Autowired
    private BaseAnimateChapterContentService baseAnimateChapterContentService;



    public  PageInfo<AnimateChapterContent> getContent(Long workId,Long chapterId,Integer page ,Integer size){
        Example example = new Example( AnimateChapterContent.class);

        example.createCriteria()
                .andEqualTo("workId",workId)
                .andEqualTo("chapterId",chapterId)
                .andEqualTo("isDel",Consts.ENABLE)
                .andEqualTo("showStatus",Consts.ENABLE);

        example.orderBy("idxOrder").asc();

        return baseAnimateChapterContentService.queryByExampleAndRowBounds(example, page, size);

    }


}
